<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>整改反馈单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/weadmin.css">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<div style="width:794px; margin:0 auto;">
    <div style="width:100%; margin:0 auto;padding-top:20px;" id="zgfkdDiv">
        <style>
            .layui-table td{
                border-color: #000;
            }
            .layui-table th{
                border-color: #000;
            }
        </style>
        <p style="font-size: 18px; text-align: center;font-weight: 700; line-height: 70px; height: 70px;">质量整改反馈单</p>
        <p>项目名称：<span id="prjName"></span> </p>
        <table class="layui-table" id="zgfkd">
            <colgroup>
                <col width="200">
                <col width="300">
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>基本信息</th>
                <th>问题详情</th>
                <th>整改照片及整改回复</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td colspan="3">
                    <p>&nbsp;</p>
                    <p style="">
                        <span style="">复查人：</span>
                        <span style="margin-left:150px;">复查结果：</span>
                        <span style="margin-left:160px;">复查日期：</span>
                    </p>
                    <p>&nbsp;</p>
                </td>
            </tr>
            </tbody>
        </table>

    </div>
</div>
<div style="width:794px; margin:0 auto; text-align: right">
    <button type="button" class="layui-btn" id="zgfkdPrint">打印</button>
    <button type="button" class="layui-btn layui-btn-warm" id="zgfkdClose">关闭</button>
</div>



<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<script>
    layui.use(['jquery', 'configureCom', 'configure', 'sessionFun', 'table'], function () {
        var $ = layui.jquery;
        var configure = layui.configure;
        var table = layui.table;
        var sessionFun = layui.sessionFun;
        var configureCom = layui.configureCom;
        var listData = sessionFun.get(configure.SESSION_QLY_INSPECTION_ROW_DATA);
        var token = sessionFun.get(configure.SESSION_TOKEN) ? sessionFun.get(configure.SESSION_TOKEN).token : '';
        console.log(listData);
        var insId = listData.insId;

        $("#prjName").html(listData.prjName);

        //加载问题列表
        $.ajax({
            type: "POST",
            url: configure.QLY_INSPECTION_ITEM_LIST_REFORM_API,
            data: {"token": token, "insId": insId},
            success: function (data) {
                var code = data.code;
                var msg = data.msg;
                if (code == "0" || msg == "success") {
                    var list = data.data;
                    if(list && list.length>0){
                        var queNum = list.length;
                        for(var i=0; i<list.length; i++){
                            var newRow = "<tr>";
                            newRow = newRow+"<td>"
                                +"<p>工区："+list[i].areaName+"</p>"
                                +"<p>部位："+list[i].position+"</p>"
                                +"<p>检查人："+list[i].inspectionUserName+"</p>"
                                +"<p>整改责任人："+((list[i].workAreaResponsibleUserName)?list[i].workAreaResponsibleUserName:'')+"</p>"
                                +"<p>检查日期："+list[i].createTime+"</p>"
                                +"</td>";
                            newRow = newRow+"<td valign=\"top\">"
                                +"<p>问题描述："+list[i].queDesc+"</p>"
                                +"<p>整改要求："+list[i].zgyq+"</p>"
                                +"<p>现场照片：</p>";
                            //增加现场照片
                            if(list[i].insAtts && list[i].insAtts.length>0){
                                var idx;
                                for(idx in list[i].insAtts){
                                    newRow = newRow + "<img style=\"max-width:200px\" src=\"/api/sys/doc/att/"+list[i].insAtts[idx].id+"?token="+token+"\">";
                                }
                            }
                            newRow = newRow+"</td>";

                            newRow = newRow+"<td valign=\"top\">"
                                +"<p>整改描述："+(list[i].reformDesc?list[i].reformDesc:'')+"</p>"
                                +"<p>整改责任人："+((list[i].workAreaResponsibleUserName)?list[i].workAreaResponsibleUserName:'')+"</p>"
                                +"<p>整改完成日期："+(list[i].reformTime?list[i].reformTime:'')+"</p>"
                                +"<p>整改照片：</p>"
                            //增加现场照片
                            if(list[i].refAtts && list[i].refAtts.length>0){
                                var idx;
                                for(idx in list[i].refAtts){
                                    newRow = newRow + "<img style=\"max-width:200px\" src=\"/api/sys/doc/att/"+list[i].refAtts[idx].id+"?token="+token+"\">";
                                }
                            }
                            newRow = newRow+"</td></tr>";
                            $("#zgfkd tbody tr:eq(0)").before(newRow);
                        }
                        $("#queNum").html(queNum);
                    }

                } else {
                    layer.msg(data.msg);
                }
                layer.closeAll('loading');
            }
        });

        $(document).on('click','#zgfkdPrint',function(){
            var zgfkdHtml = $("#zgfkdDiv").prop("outerHTML");
            var oldstr = document.body.innerHTML;
            window.document.body.innerHTML=zgfkdHtml;
            window.print();
            document.body.innerHTML = oldstr;
        });

        $(document).on('click','#zgfkdClose',function(){
            var currentLay = parent.layer.getFrameIndex(window.name);
            parent.layer.close(currentLay);
        });
    });
</script>
</body>
</html>